$(function(){
	/* --------------------- header --------------------- */
	$(".mob-header .menu-handler").click(function(){
		$(".mob-header-menu").toggleClass("active");
		$(".mob-header").toggleClass("active");
		$("html,body").toggleClass("ov-h");
	})
	$(".mob-header-menu .menu-item-dropdown .menu-link").click(function(){
		var li = $(this).parents(".menu-item");
		li.toggleClass("active");
	});

	/* --------------------- footer --------------------- */
	$(window).scroll(function(){
		mtotop();
	});
	mtotop();
	function mtotop(){
		var wt = $(document).scrollTop();
		var f = $(".mob-fixed-footer");
		var t = f.find(".j-top");
		if(wt > 0){
			f.addClass("on");
		}else{
			f.removeClass("on");
		}
	}
	$(".mob-fixed-footer .j-top").click(function(){
		console.log("clicktop")
		$("html,body").animate({scrollTop: 0});
	})



	/* --------------------- index --------------------- */
	if($(".page-index").length > 0){
		$(window).scroll(function(){
			mwt();
		});
		mwt();
		function mwt(){
			var wt = $(document).scrollTop();
			var hd = $(".page-index .mob-header");
			if(wt > 0){
				hd.addClass("header_down");
			}else{
				hd.removeClass("header_down");
			}
		}
	}
	var swiper_index_s2 = new Swiper(".page-index .mob-s2 .s-box-1 .swiper-container",{
		autoHeight: true,
		onSlideChangeStart: function(swiper){
	      $(".page-index .mob-s2 .s-box-1 .s-tab .item").eq(swiper.activeIndex).addClass('on').siblings().removeClass("on");
	    }

	})
	$(".page-index .mob-s2 .s-box-1 .s-tab .item").click(function(e){
		e.preventDefault()
	    $(this).addClass('on').siblings().removeClass("on");
	    swiper_index_s2.slideTo( $(this).index() )

	})
	new Swiper(".page-index .mob-s4 .swiper-container",{
		pagination: '.page-index .mob-s4 .swiper-pagination'
	});

	// swiper
	new Swiper(".page-platform .mob-s2 .swiper-container",{
		pagination: '.page-platform .mob-s2 .swiper-pagination'
	});
	new Swiper(".page-platformsupply .mob-s2 .swiper-container",{
		pagination: '.page-platformsupply .mob-s2 .swiper-pagination',
		paginationClickable: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['发布需求', '展示信息', '接单联系'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	new Swiper(".page-weshop .mob-s5 .swiper-container",{
		pagination: '.page-weshop .mob-s5 .swiper-pagination',
		paginationClickable: true,
		autoHeight: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['限时秒杀', '达人说', '等级升级和邀请'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	new Swiper(".page-applet .mob-s3 .swiper-container",{
		pagination: '.page-applet .mob-s3 .swiper-pagination',
		paginationClickable: true,
		autoHeight: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['京东全网优惠券', '拼多多全优惠券'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	new Swiper(".page-backstage .mob-s1 .swiper-container",{
		pagination: '.page-backstage .mob-s1 .swiper-pagination',
		paginationClickable: true,
		autoHeight: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['首页数据概况', '促销活动管理'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	new Swiper(".page-backstageseller .mob-s1 .swiper-container",{
		pagination: '.page-backstageseller .mob-s1 .swiper-pagination',
		paginationClickable: true,
		autoHeight: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['商家后台概述', '商品信息管理'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	new Swiper(".page-backstagestore .mob-s1 .swiper-container",{
		pagination: '.page-backstagestore .mob-s1 .swiper-pagination',
		paginationClickable: true,
		autoHeight: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['商品信息管理', '门店订单列表'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	new Swiper(".page-backstagesupply .mob-s1 .swiper-container",{
		pagination: '.page-backstagesupply .mob-s1 .swiper-pagination',
		paginationClickable: true,
		autoHeight: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['后台信息概述', '批发商品管理'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	new Swiper(".page-im .mob-s2 .swiper-container",{
		pagination: '.page-im .mob-s2 .swiper-pagination',
		paginationClickable: true,
		autoHeight: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['客服聊天（消费者）', '客服聊天（商家）'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	new Swiper(".page-admission .mob-s5 .swiper-container",{
		pagination: '.page-admission .mob-s5 .swiper-pagination',
		paginationClickable: true,
		autoHeight: true,
        paginationBulletRender: function (swiper, index, className) {
        	var txt = ['可视化装修', '平台商品库', '商家二级域名设置'];
            return '<span class="item '+className +'">' + txt[index] + '</span>';
        }
	});
	
})